﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using AutoMapper;
using SimpleServiceBus.EndpointManagement.Wcf.Contracts.Data;
using SimpleServiceBus.Persistence.Domain.Management.Entities;

namespace SimpleServiceBus.EndpointManagement.Server.Wcf
{
    public class AutoMapperContractMapper : IContractMapper
    {
        static AutoMapperContractMapper()
        {
            Mapper.CreateMap<ManagedEndpoint, ManagedEndpointContract>();
            Mapper.CreateMap<EndpointError, EndpointErrorContract>();
            Mapper.CreateMap<EndpointPerformanceSummary, EndpointPerformanceSummaryContract>();
            Mapper.CreateMap<EndpointMetricType, EndpointMetricTypeContract>();
        }

        public TDestinationType Map<TSourceType,TDestinationType>(TSourceType source)
        {
            return Mapper.Map<TSourceType, TDestinationType>(source);
        }
    }
}
